import {Navigate} from "react-router-dom";
import A from '../view/dom4'
import {lazy} from "react";



// 二级路由
const aRoutes = [
    {
        path:'/a',
        component:() => <Navigate to={'/a/a1'}/>
    },
    {
        path:'/a/a1',
        name:'a-a1',
        meta:{},
        component:lazy(() => import('../view/useReducer/index'))
    }
]

// 一级路由
const routes = [
    {
        path:'/',
        component:() => <Navigate to={'/a'}/>
    },
    {
        path:'/a',
        name:'a',
        component:A,
        meta:{},
        children:aRoutes
    },
    {
        path:'/b',
        name:'b',
        meta:{},
        component: lazy(() => import('../view/route-dom/a.jsx')),
    },
    {
        path:'/c',
        name:'c',
        meta:{},
        component: lazy(() => import('../view/route-dom/b.jsx')),
    },
    {
        path:'*',
        component:() => <Navigate to={{
            pathname:'/a',
            search:'?from=404'
        }}/>
    }
]

export default routes
